
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"
	isELIgnored="false"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link href="<%=request.getContextPath()%>/css/style.css"
	rel="stylesheet" type="text/css" />
<link href="<%=request.getContextPath()%>/css/select.css"
	rel="stylesheet" type="text/css" />
<script type="text/javascript"
	src="<%=request.getContextPath()%>/js/jquery.js"></script>
<script type="text/javascript"
	src="<%=request.getContextPath()%>/js/jquery.idTabs.min.js"></script>
<script type="text/javascript"
	src="<%=request.getContextPath()%>/js/select-ui.min.js"></script>
<script type="text/javascript">
	function chongzhi(a) {
		var recharge_money = $(a).val();
		if (!/^\d+$/.test(recharge_money)) {
			alert("请输入正整数");
			$(a).val($(a).next().val());
		}
	}
</script>
</head>

<body>

	<div class="place">
		<span>位置：</span>
		<ul class="placeul">
			<li><e>首页</e></li>
			<li><e>财务管理</e></li>
			<li><e>平台费用设置</e></li>
		</ul>
	</div>

	<div class="formbody">


		<div id="usual1" class="usual">

			<div class="itab">
				<ul>
					<li><a href="#tab1" class="selected" style="font-size: 15">平台费用设置</a></li>

				</ul>
			</div>

			<div id="tab1" class="tabson">
				<ul class="forminfo">
					<c:forEach items="${lists}" var="data">
						<li>请输入平台手续费（百分比）： <input onchange="chongzhi(this)"
							name="discount" type="text" class="dfinput"
							style="width: 40px; height: 20px;" value="${data.discount}" />% <input
							type="hidden" value="${data.id}" />
						</li>
						<li>请选择是否自动提现： <input type="radio" name="on_off" value="1"
							${flag == "1"?'checked':''}>开 <input type="radio"
							name="on_off" value="0" ${flag == "0"?'checked':''}>关
						</li>
					</c:forEach>
				</ul>
		
  <!--               	<ul class="forminfo" style="margin-top: 5px;">
					<li> <input name="" type="button" class="backupsAll"
						value="备份"
						style="width: 96px; height: 35px; line-height: 35px; color: #fff; background: red; font-size: 14px; font-weight: bold; border-radius: 3px; cursor: pointer;" />
						<input name="" type="button" class="recoveryALL" value="恢复"
						style="width: 96px; height: 35px; line-height: 35px; color: #fff; background: red; font-size: 14px; font-weight: bold; border-radius: 3px; cursor: pointer;" />
					</li>
				</ul> -->
                		<div style="margin-left: 50px;">
					<input name="" type="button" class="tijiao" value="提交"
						style="width: 96px; height: 35px; line-height: 35px; color: #fff; background: red; font-size: 14px; font-weight: bold; border-radius: 3px; cursor: pointer;" />
				</div>
								<ul class="forminfo" style="margin-top: 5px;">
					<li>APP是否可用：  启用：<input name="radio" type="radio" class="qiyong"  value="0" />
    &nbsp;&nbsp;&nbsp;&nbsp;    停用：<input name="radio" type="radio" class="tingyong"  value="1" /> </li>
				</ul>
			</div>

			<script type="text/javascript">
			 if('${listc}'!=null){
				 if('${listc.status }'=='0'){
					  $("input:radio[name=radio][value=0]").attr("checked",true);  
				  }
				 if('${listc.status }'=='1'){
					  $("input:radio[name=radio][value=1]").attr("checked",true);  
				  }
			 }
				$(function() {
					$(".tijiao")
							.click(
									function() {
										var discount = $("input[name=discount]")
												.val();
										var on_off = $(
												"input[name='on_off']:checked")
												.val();
										if (discount == null || discount == "") {
											alert("请先设置手续费");
											return;
										}
										if (on_off == null || on_off == "") {
											alert("请选择开关");
											return;
										}
										$
												.ajax({
													type : "get",
													url : "/htx-backer/updatePlatformDiscount",
													data : {
														discount : discount,
														on_off : on_off,
													},
													dataType : "json",
													success : function(data) {
														if (data.flag > 0) {
															var btn = confirm("提交成功!")
															window.location.href = "/htx-backer/platformDiscount";
														}
													}
												})
									})
									
									$(".qiyong")
									.click(
											function() {
												$
														.ajax({
															type : "get",
															url : "/htx-backer/updateApp",
															data : {
																id : '${listc.id}',
																status : 0
															},
															dataType : "json",
															success : function(data) {
																if (data.flag > 0) {
																	var btn = confirm("启用成功!")
																	window.location.href = "/htx-backer/platformDiscount";
																}
															}
														})
											})
							$(".tingyong").click(function() {
												$.ajax({
															type : "get",
															url : "/htx-backer/updateApp",
															data : {
																id : '${listc.id}',
																status : 1
															},
															dataType : "json",
															success : function(data) {
																if (data.flag > 0) {
																	var btn = confirm("停用成功!")
																	window.location.href = "/htx-backer/platformDiscount";
																}
															}
														})
											})
		 $(".backupsAll").click(function(){
			  $.ajax({
	  				type:"get",
	  				url:"/htx-backer/backupsAll", 
	  				data:{
	  				},
	  				success:function(data){
	  					if(data == "OK"){
	  					 	alert("备份成功!");
	  					}else{
	  						alert("备份失败!");
	  					}
	  					
	  				}
				}) 
		 })
		  $(".recoveryALL").click(function(){
			  $.ajax({
	  				type:"get",
	  				url:"/htx-backer/recoveryAll", 
	  				data:{
	  				},
	  				success:function(data){
	  					if(data == "OK"){
	  					 	var btn = confirm("恢复成功,点击确定刷新列表!")
	  					 	if(btn == true){
			   					window.location.href="<%=request.getContextPath()%>/platformDiscount";
	  					 	}
	  					}else{
	  						alert("恢复失败!");
	  					}
	  				}
				}) 
		 })
				})
			</script>
</body>
</html>

